//#include<iostream>
//#include<map>
//#include<set>
//using namespace std;
//#include"RBTree.h"
//int main()
//{
//
//	return 0;
//}
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	struct student
	{
		long number;
		char name;
		float score;
	}stu1, stu2;
	scanf("%d %s %d", &stu1.number, &stu1.name, &stu1.score);
	scanf("%d %s %d", &stu2.number, &stu2.name, &stu2.score);
	if (stu1.score > stu2.score)
		printf("%ld %s %d n", stu1.number, stu1.name, stu1.score);
	else
		printf("%ld %s %d n", stu2.number, stu2.name, stu2.score);
	return 0;
}